home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / idna.h < prev    next >
Encoding:
C/C++ Source or Header  |  2008-02-26  |  2.8 KB  |  101 lines

  1. /* idna.h --- Declarations for Internationalized Domain Name in Applications.
  2.  * Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007  Simon Josefsson
  3.  *
  4.  * This file is part of GNU Libidn.
  5.  *
  6.  * GNU Libidn is free software; you can redistribute it and/or
  7.  * modify it under the terms of the GNU Lesser General Public
  8.  * License as published by the Free Software Foundation; either
  9.  * version 2.1 of the License, or (at your option) any later version.
  10.  *
  11.  * GNU Libidn is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14.  * Lesser General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU Lesser General Public
  17.  * License along with GNU Libidn; if not, write to the Free Software
  18.  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
  19.  *
  20.  */
  21.  
  22. #ifndef _IDNA_H
  23. # define _IDNA_H
  24.  
  25. # ifdef __cplusplus
  26. extern "C"
  27. {
  28. # endif
  29.  
  30. # include <stddef.h>        /* size_t */
  31. # include <idn-int.h>        /* uint32_t */
  32.  
  33.   /* Error codes. */
  34.   typedef enum
  35.   {
  36.     IDNA_SUCCESS = 0,
  37.     IDNA_STRINGPREP_ERROR = 1,
  38.     IDNA_PUNYCODE_ERROR = 2,
  39.     IDNA_CONTAINS_NON_LDH = 3,
  40.     /* Workaround typo in earlier versions. */
  41.     IDNA_CONTAINS_LDH = IDNA_CONTAINS_NON_LDH,
  42.     IDNA_CONTAINS_MINUS = 4,
  43.     IDNA_INVALID_LENGTH = 5,
  44.     IDNA_NO_ACE_PREFIX = 6,
  45.     IDNA_ROUNDTRIP_VERIFY_ERROR = 7,
  46.     IDNA_CONTAINS_ACE_PREFIX = 8,
  47.     IDNA_ICONV_ERROR = 9,
  48.     /* Internal errors. */
  49.     IDNA_MALLOC_ERROR = 201,
  50.     IDNA_DLOPEN_ERROR = 202
  51.   } Idna_rc;
  52.  
  53.   /* IDNA flags */
  54.   typedef enum
  55.   {
  56.     IDNA_ALLOW_UNASSIGNED = 0x0001,
  57.     IDNA_USE_STD3_ASCII_RULES = 0x0002
  58.   } Idna_flags;
  59.  
  60. # ifndef IDNA_ACE_PREFIX
  61. #  define IDNA_ACE_PREFIX "xn--"
  62. # endif
  63.  
  64.   extern const char *idna_strerror (Idna_rc rc);
  65.  
  66.   /* Core functions */
  67.   extern int idna_to_ascii_4i (const uint32_t * in, size_t inlen,
  68.                    char *out, int flags);
  69.   extern int idna_to_unicode_44i (const uint32_t * in, size_t inlen,
  70.                   uint32_t * out, size_t * outlen, int flags);
  71.  
  72.   /* Wrappers that handle several labels */
  73.  
  74.   extern int idna_to_ascii_4z (const uint32_t * input,
  75.                    char **output, int flags);
  76.  
  77.   extern int idna_to_ascii_8z (const char *input, char **output, int flags);
  78.  
  79.   extern int idna_to_ascii_lz (const char *input, char **output, int flags);
  80.  
  81.  
  82.   extern int idna_to_unicode_4z4z (const uint32_t * input,
  83.                    uint32_t ** output, int flags);
  84.  
  85.   extern int idna_to_unicode_8z4z (const char *input,
  86.                    uint32_t ** output, int flags);
  87.  
  88.   extern int idna_to_unicode_8z8z (const char *input,
  89.                    char **output, int flags);
  90.  
  91.   extern int idna_to_unicode_8zlz (const char *input,
  92.                    char **output, int flags);
  93.  
  94.   extern int idna_to_unicode_lzlz (const char *input,
  95.                    char **output, int flags);
  96.  
  97. # ifdef __cplusplus
  98. }
  99. # endif
  100. #endif                /* _IDNA_H */
  101.